<?php
    session_start();
    if(isset($_SESSION['admin'])){
        require_once("../model/Venda.php");
        $result = array();
        $objVenda = new Venda();
        $consulta=$objVenda->buscaComprasCliente($_POST['cpf']);
        while ($row = mysql_fetch_array($consulta, MYSQL_ASSOC)){
              array_push( $result, $row);
        }        
        echo json_encode($result);
    }else{
        header("Location: index.php");
    }
?>